import Vue from 'vue';
import Router from 'vue-router';
import Login from '@/view/background/login/Login';
import Home from '@/view/background/Home';
import Dash from '@/view/background/blog/views/DashBoard';
import Post from '@/view/background/blog/views/PostPage';
import Manager from '@/view/background/blog/views/PostManager';
import User from '@/view/background/blog/views/UserPage';
import ProjectManager from '@/view/background/blog/views/ProjectManager';
import Blog from '@/view/foreground/Blog';
import ONE from '@/view/foreground/page/ONE';
import Index from '@/view/foreground/page/home/HomePage';
import Article from '@/view/foreground/page/article/ArticlePage';
import Fun from '@/view/foreground/page/more/FunPage';
import About from '@/view/foreground/page/about/AboutPage';
import NotFound from '@/components/base/NotFound';
import CssLayout from '@/view/codefun/LayoutLab';
import TimeLocker from '@/view/codefun/TimeLocker';
import TestPage from '@/view/codefun/TestPage';
import TypeFun from '@/view/codefun/TypeFun';
import ThreeDLab from '@/view/codefun/ThreeDLab';

Vue.use(Router);

let backPrefix = '后台管理 | ';
let brandName = '沉洋 | ';

export default new Router({
	routes: [
		{
			path: '/login',
			name: 'login',
			component: Login,
			meta: {
				title: '登录'
			}
		},
		{
			path: '/sys',
			name: 'Home',
			component: Home,
			redirect: '/sys/dash',
			children: [
				{
					path: 'dash',
					component: Dash,
					meta: {
						title: backPrefix + '仪表盘'
					}
				},
				{
					path: 'post/:id?',
					component: Post,
					meta: {
						title: backPrefix + '文章撰写'
					}
				},
				{
					path: 'manage',
					component: Manager,
					meta: {
						title: backPrefix + '文章管理'
					}
				},
				{
					path: 'user',
					component: User,
					meta: {
						title: backPrefix + '用户中心'
					}
				},
				{
					path: 'project',
					component: ProjectManager,
					meta: {
						title: backPrefix + '项目管理'
					}
				},
				{
					path: 'setting',
					component: () => import('@/view/background/blog/views/setting/Setting.vue'),
					meta: {
						title: backPrefix + '设置'
					}
				},
				{
					path: 'user',
					component: () => import('@/view/background/blog/views/UserPage.vue'),
					meta: {
						title: backPrefix + '用户信息'
					}
				}
			]
		},
		{
			path: '/css-layout',
			component: CssLayout,
			meta: {
				title: brandName + 'CSS布局'
			}
		},
		{
			path: '/time',
			component: TimeLocker,
			meta: {
				title: '时钟锁屏'
			}
		},
		{
			path: '/lab',
			component: TestPage,
			meta: {
				title: '实验室'
			}
		},
		{
			path: '/3D',
			component: ThreeDLab,
			meta: {
				title: '3D实验室'
			}
		},
		{
			path: '/typing',
			component: TypeFun,
			meta: {
				title: '打字练习'
			}
		},
		{
			path: '/typingChinese',
			component: () => import('@/view/codefun/TypeFunForChinese'),
			meta: {
				title: '打字练习（中文版）'
			}
		},
		{
			path: '/fileSystem',
			component: () => import('@/view/codefun/filesystem/FileSystem'),
			meta: {
				title: '文件管理系统'
			}
		},
		{
			path: '/one',
			name: 'ONE',
			component: ONE
		},
		{
			path: '/',
			name: 'Blog',
			component: Blog,
			redirect: '/one',
			children: [
				{
					path: 'index',
					component: Index
				},
				{
					path: 'article/:id',
					component: Article,
					meta: {
						title: brandName + '阅读'
					}
				},
				{
					path: 'fun',
					component: Fun,
					meta: {
						title: brandName + '趣味'
					}
				},
				{
					path: 'about',
					component: About,
					meta: {
						title: brandName + '关于'
					}
				}
			]
		},
		{
			path: '/*',
			name: 'notfound',
			component: NotFound,
			meta: {
				title: brandName + '404'
			}
		}
	]
});
